#include "usb_device.h"

usb_core_driver cdc_acm;


void USB_DEVICE_Init(void){
    rcu_periph_clock_enable(RCU_USBFS);

    usbd_init(&cdc_acm,USB_CORE_ENUM_FS,&cdc_desc,&cdc_class);

    nvic_irq_enable((uint8_t)USBFS_IRQn, 5U, 0U);
}

/* delay in micro seconds */
void usb_udelay (const uint32_t usec){
    delay_1us(usec);
}
/* delay in milliseconds */
void usb_mdelay (const uint32_t msec){
    delay_1ms(msec);
}

/* int _write(int file, char *ptr, int len)
{
    usbd_ep_send (&cdc_acm, CDC_DATA_IN_EP, ptr, len);
    return len;
} */